<?php

namespace App\Observers;

use App\Model\Zan;

class ZanObserver
{
    /**
     * Handle the zan "created" event.
     *
     * @param  \App\Model\Zan  $zan
     * @return void
     */
    public function created(Zan $zan)
    {
       $zan->getModel()->increment('zan_num');
    }

    /**
     * Handle the zan "updated" event.
     *
     * @param  \App\Model\Zan  $zan
     * @return void
     */
    public function updated(Zan $zan)
    {
        //
    }

    /**
     * Handle the zan "deleted" event.
     *
     * @param  \App\Model\Zan  $zan
     * @return void
     */
    public function deleted(Zan $zan)
    {
        $zan->getModel()->decrement('zan_num');

    }

    /**
     * Handle the zan "restored" event.
     *
     * @param  \App\Model\Zan  $zan
     * @return void
     */
    public function restored(Zan $zan)
    {
        //
    }

    /**
     * Handle the zan "force deleted" event.
     *
     * @param  \App\Model\Zan  $zan
     * @return void
     */
    public function forceDeleted(Zan $zan)
    {
        //
    }
}
